<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" id="num1">
    <select id="type">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">x</option>
        <option value="/">÷</option>
    </select>
    <input type="text" id="num2">
    <button id="compute">=</button>
    <span id="result"></span>
    <script>
        // 获取dom元素
        var num1 = document.getElementById("num1")
        var type = document.getElementById("type")
        var num2 = document.getElementById("num2")
        var compute = document.getElementById("compute")
        var result = document.getElementById("result")
        compute.onclick = function () {
            switch (typeValue) {
                case "+":
                    result.innerHTML = +num1Value + +num2Value
                    break
                case "-":
                    result.innerHTML = +num1Value - +num2Value
                    break
                case "*":
                    result.innerHTML = +num1Value * +num2Value
                    break
                case "/":
                    result.innerHTML = +num1Value / +num2Value
                    break
            }
        }

    </script>
</body>

</html>